package com.du.springmvc.controller;

import com.du.springmvc.pojo.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * @author : DuJiabao
 * @Date : 2021/3/30 20:19
 * @Project : spring-mvc
 * @File : null.java
 * @Desc :
 */
@Controller
public class DaoController {
  @ModelAttribute
  void updateRequest(Map<String, Object> map) {
    Student student = new Student(1, "jack", "high school", 1);
    map.put("student", student);
    Student student1 = new Student(2, "lucy", "high school", 0);
    map.put("abc", student1);
  }

  @RequestMapping("updateDao")
  String updateDao(Student student) {
    System.out.println(student);
    return "hello";
  }

  @RequestMapping("updateDao1")
  String updateDao1(@ModelAttribute("abc") Student student) {
    System.out.println(student);
    return "hello";
  }

}
